<%@page import="beans.ClassBean"%>
<%@page import="java.util.List"%>
<%@page import="dao.MngClass"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Update Account Page</title>
    </head>
    <body>
        <%
            if (request.getAttribute("msg") != null) {
        %>
        <font color="green" > <%= request.getAttribute("msg")%> </font>
        <%
            }
            if (request.getAttribute("error") != null) {
        %>
        <font color="red" > <%= request.getAttribute("error")%> </font>
        <%
            }
        %>
        <form action="updateAcc" method="get">
            <table>
                <strong>Account ID : <%= request.getAttribute("acc_id")%> </strong><br>            
                <input type="hidden" name="acc_id" value="<%= request.getAttribute("acc_id")%>"><br>
                <tr>
                    <td> Username</td>
                    <td><input type="text" name="username" value="<%= request.getAttribute("username")%>"><font color="red">*</font></td>
                </tr>
                <tr>
                    <td>Password</td>
                    <td> <input type="text" name="password" value="<%= request.getAttribute("password")%>"><font color="red">*</font></td> 
                </tr>
                <tr>
                    <td>Full name</td>
                    <td> <input type="text" name="full_name" value="<%= request.getAttribute("full_name")%>"><font color="red">*</font> </td>
                </tr>
                <tr>
                    <td>Gender</td> 
                    <td><%
                        String strgender = "";
                        String gender = request.getAttribute("gender").toString();
                        if (gender.equals("0")) {
                            strgender = "Nữ";
                        } else {
                            strgender = "Nam";
                        }
                        %>
                        <select name="gender">
                            <option value="<%= gender%>"><%= strgender%></option>
                            <%if (gender.equals("0")) { %>
                            <option value="1">Nam</option>
                            <% } else { %>
                            <option value="0">Nữ</option>
                            <% }%>
                        </select><font color="red">*</font>
                    </td>
                </tr>
                <tr>
                    <td>Address</td>
                    <td><input type="text" name="address" value="<%= request.getAttribute("address")%>"></td>                        
                </tr>
                <tr>
                    <td>Phone</td>
                    <td><input type="text" name="phone" value="<%= request.getAttribute("phone")%>"></td>
                </tr>
                <tr>
                    <td>Email</td>
                    <td><input type="text" name="email" value="<%= request.getAttribute("email")%>"></td>
                </tr>
                <tr>
                    <td>Roll</td>
                    <td> <select name="roll">
                            <%
                                String roll = request.getAttribute("roll").toString();
                            %>
                            <option value="<%= roll%>"><%= roll%></option>
                            <%if (roll.equals("admin")) { %> 
                            <option value="staff">staff</option>
                            <option value="student">student</option>
                            <% } else if (roll.equals("staff")) { %>
                            <option value="admin">admin</option>   
                            <option value="student">student</option>
                            <% } else { %> 
                            <option value="admin">admin</option>   
                            <option value="staff">staff</option>
                            <% }%>
                        </select><font color="red">*</font>
                    </td>
                </tr>                
                <tr>
                    <td></td>
                    <td> <input type="submit" value="Update"></td>
                </tr>
            </table>
        </form>
    </body>
</html>
